package com.han.elasticsearch.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author hanjl
 * @Description ES配置信息
 * @ClassName ElasticSearchConfig
 * @createTime 2021/12/15 10:39
 */
@Configuration
public class ElasticSearchConfig {


    @Bean
    public RestHighLevelClient restHighLevelClient(){
        RestHighLevelClient client = new RestHighLevelClient(
                RestClient.builder(
                        new HttpHost("127.0.0.1",9200,"http"),
                        new HttpHost("127.0.0.1",9202,"http"),
                        new HttpHost("127.0.0.1",9203,"http")
                )
        );
        return client;
    }
}
